bitkeeper revision 1.1618 (429c9b21TCCZatsEzYuIU4HRcrJtyA)
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Tue, 31 May 2005 17:13:05 +0000 (17:13 +0000)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Tue, 31 May 2005 17:13:05 +0000 (17:13 +0000)
XendDomain.py:
  Allow migration to localhost.
  g/c XendDomain.domain_exists().
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
tools/python/xen/xend/XendDomain.py

index 5c504897aa8a4942ba0b004e1927ab67002e19bd..3fb066327f4c66e905c19b0d5bd562e484acf969 100644 (file)
@@ -8,6 +8,7 @@
 import errno
 import os
 import scheduler
+import string
 import sys
 import traceback
 import time
@@ -357,9 +358,6 @@ class XendDomain:
         except Exception, ex:
             log.exception("Error creating domain info: id=%s", name)
 
-    def domain_exists(self, name):
-        return self.domain_lookup(name) != None
-
     def domain_unpause(self, id):
         """Unpause domain execution.
 
@@ -514,7 +512,17 @@ class XendDomain:
         port = xroot.get_xend_relocation_port()
         sock = relocate.setupRelocation(dst, port)
 
-        XendCheckpoint.save(self, sock.fileno(), dominfo)
+        # temporarily rename domain for localhost migration
+        if dst == "localhost":
+            dominfo.name = "tmp-" + dominfo.name
+
+        try:
+            XendCheckpoint.save(self, sock.fileno(), dominfo)
+        except:
+            if dst == "localhost":
+                dominfo.name = string.replace(dominfo.name, "tmp-", "", 1)
+            raise
+        
         return None
 
     def domain_save(self, id, dst, progress=False):